home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_223 / popinfo / getfile.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  88 lines

  1. #include <intuition/intuitionbase.h>
  2. #include <stdio.h>
  3. #include <pragma/all.h>
  4. #include <proto/all.h>
  5. #include "PopInfo.i"
  6.  
  7. #define OKAY 1
  8. #define CANCEL 0
  9.  
  10. static char dobuffer[255],undobuffer[255];
  11.  
  12. static struct StringInfo sinfo={
  13.     dobuffer,undobuffer,0,80,0};
  14. static short borderxy[]={
  15.     -2,-1,283,-1,283,10,-2,10,-2,-1};
  16. static struct Border gadborder={
  17.     -1,-1,1,0,JAM1,5,borderxy,NULL};
  18. static struct Gadget stringgadget={
  19.     NULL,10,15,280,15,GADGHCOMP,TOGGLESELECT|RELVERIFY,STRGADGET,
  20.     (APTR)&gadborder,NULL,NULL,NULL,(APTR)&sinfo,OKAY,NULL};
  21. static struct IntuiText oktext={
  22.     1,1,JAM1,5,2,NULL,"   OKAY!!",NULL};
  23. static short borderxy1[]={
  24.     0,0,101,0,101,12,0,12,0,0};
  25. static struct Border gadborder1={
  26.     -1,-1,1,0,JAM1,5,borderxy1,NULL};
  27. static struct Gadget okgadget={
  28.     &stringgadget,8,34,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
  29.     (APTR)&gadborder1,NULL,&oktext,NULL,NULL,OKAY,NULL};
  30. static struct IntuiText notext={
  31.     1,1,JAM1,5,2,NULL,"   CANCEL",NULL};
  32. static short borderxy2[]={
  33.     0,0,101,0,101,12,0,12,0,0};
  34. static struct Border gadborder2={
  35.     -1,-1,1,0,JAM1,5,borderxy2,NULL};
  36. static struct Gadget nogadget={
  37.     &okgadget,191,34,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
  38.     (APTR)&gadborder2,NULL,¬ext,NULL,NULL,CANCEL,NULL};
  39.  
  40. static struct NewWindow fw={
  41.     0,0,299,50,
  42.     0,3,
  43.     GADGETUP,
  44.     WINDOWDRAG|ACTIVATE|RMBTRAP,
  45.     &nogadget,
  46.     NULL,
  47.     "",
  48.     NULL,NULL,
  49.     0,0,0,0,CUSTOMSCREEN
  50. };
  51.  
  52. static struct Window *MyWindow;
  53. static struct IntuiMessage *MyMsg;
  54. static struct IntuitionBase *IntuitionBase;
  55.  
  56. gf(title,x,y)
  57. char *title;
  58. int x,y;
  59. {
  60.     static struct Gadget *gad;
  61.     int gadgetid;
  62.     IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",0);
  63.     fw.Title=title;
  64.     if (x+300>640) x=340;
  65.     if (y+50>200) y=150;
  66.     fw.TopEdge=y;
  67.     fw.LeftEdge=x;
  68.     fw.Screen=(struct Screen *) IntuitionBase->ActiveScreen;
  69.     MyWindow=(struct Window *) OpenWindow(&fw);
  70.     ActivateGadget(&stringgadget,MyWindow,NULL);
  71.     for (;;) {
  72.         Wait (1L<<MyWindow->UserPort->mp_SigBit);
  73.         while (MyMsg=GetMsg(MyWindow->UserPort)) {
  74.             ReplyMsg(MyMsg);
  75.             if (MyMsg->Class==GADGETUP) {
  76.                 gad=(struct Gadget *) MyMsg->IAddress;
  77.                 gadgetid=gad->GadgetID;
  78.                 if (gadgetid!=OKAY && gadgetid!=CANCEL) break;
  79.                 CloseWindow(MyWindow);
  80.                 CloseLibrary(IntuitionBase);
  81.                 if (gadgetid==CANCEL) return(NULL);
  82.                 return(dobuffer);
  83.             }
  84.         }
  85.     }
  86. }
  87.  
  88.